/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tok.predmeta;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author mega
 */
@Entity
@Table(name = "predmeti2", catalog = "tok_predmeta", schema = "")
@NamedQueries({
    @NamedQuery(name = "Predmeti2.findAll", query = "SELECT p FROM Predmeti2 p"),
    @NamedQuery(name = "Predmeti2.findById", query = "SELECT p FROM Predmeti2 p WHERE p.id = :id"),
    @NamedQuery(name = "Predmeti2.findBySifra", query = "SELECT p FROM Predmeti2 p WHERE p.sifra = :sifra"),
    @NamedQuery(name = "Predmeti2.findByKorisnickaSifra", query = "SELECT p FROM Predmeti2 p WHERE p.korisnickaSifra = :korisnickaSifra"),
    @NamedQuery(name = "Predmeti2.findByIme", query = "SELECT p FROM Predmeti2 p WHERE p.ime = :ime"),
    @NamedQuery(name = "Predmeti2.findByPrezime", query = "SELECT p FROM Predmeti2 p WHERE p.prezime = :prezime"),
    @NamedQuery(name = "Predmeti2.findByAdresa", query = "SELECT p FROM Predmeti2 p WHERE p.adresa = :adresa"),
    @NamedQuery(name = "Predmeti2.findByJmbg", query = "SELECT p FROM Predmeti2 p WHERE p.jmbg = :jmbg"),
    @NamedQuery(name = "Predmeti2.findByTip", query = "SELECT p FROM Predmeti2 p WHERE p.tip = :tip"),
    @NamedQuery(name = "Predmeti2.findByDatum", query = "SELECT p FROM Predmeti2 p WHERE p.datum = :datum"),
    @NamedQuery(name = "Predmeti2.findByKorisnik", query = "SELECT p FROM Predmeti2 p WHERE p.korisnik = :korisnik")})
public class Predmeti2 implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "sifra")
    private String sifra;
    @Basic(optional = false)
    @Column(name = "korisnicka_sifra")
    private String korisnickaSifra;
    @Basic(optional = false)
    @Column(name = "ime")
    private String ime;
    @Basic(optional = false)
    @Column(name = "prezime")
    private String prezime;
    @Basic(optional = false)
    @Column(name = "adresa")
    private String adresa;
    @Basic(optional = false)
    @Column(name = "jmbg")
    private String jmbg;
    @Basic(optional = false)
    @Column(name = "tip")
    private String tip;
    @Basic(optional = false)
    @Column(name = "datum")
    private String datum;
    @Basic(optional = false)
    @Column(name = "korisnik")
    private String korisnik;

    public Predmeti2() {
    }

    public Predmeti2(Integer id) {
        this.id = id;
    }

    public Predmeti2(Integer id, String sifra, String korisnickaSifra, String ime, String prezime, String adresa, String jmbg, String tip, String datum, String korisnik) {
        this.id = id;
        this.sifra = sifra;
        this.korisnickaSifra = korisnickaSifra;
        this.ime = ime;
        this.prezime = prezime;
        this.adresa = adresa;
        this.jmbg = jmbg;
        this.tip = tip;
        this.datum = datum;
        this.korisnik = korisnik;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getSifra() {
        return sifra;
    }

    public void setSifra(String sifra) {
        String oldSifra = this.sifra;
        this.sifra = sifra;
        changeSupport.firePropertyChange("sifra", oldSifra, sifra);
    }

    public String getKorisnickaSifra() {
        return korisnickaSifra;
    }

    public void setKorisnickaSifra(String korisnickaSifra) {
        String oldKorisnickaSifra = this.korisnickaSifra;
        this.korisnickaSifra = korisnickaSifra;
        changeSupport.firePropertyChange("korisnickaSifra", oldKorisnickaSifra, korisnickaSifra);
    }

    public String getIme() {
        return ime;
    }

    public void setIme(String ime) {
        String oldIme = this.ime;
        this.ime = ime;
        changeSupport.firePropertyChange("ime", oldIme, ime);
    }

    public String getPrezime() {
        return prezime;
    }

    public void setPrezime(String prezime) {
        String oldPrezime = this.prezime;
        this.prezime = prezime;
        changeSupport.firePropertyChange("prezime", oldPrezime, prezime);
    }

    public String getAdresa() {
        return adresa;
    }

    public void setAdresa(String adresa) {
        String oldAdresa = this.adresa;
        this.adresa = adresa;
        changeSupport.firePropertyChange("adresa", oldAdresa, adresa);
    }

    public String getJmbg() {
        return jmbg;
    }

    public void setJmbg(String jmbg) {
        String oldJmbg = this.jmbg;
        this.jmbg = jmbg;
        changeSupport.firePropertyChange("jmbg", oldJmbg, jmbg);
    }

    public String getTip() {
        return tip;
    }

    public void setTip(String tip) {
        String oldTip = this.tip;
        this.tip = tip;
        changeSupport.firePropertyChange("tip", oldTip, tip);
    }

    public String getDatum() {
        return datum;
    }

    public void setDatum(String datum) {
        String oldDatum = this.datum;
        this.datum = datum;
        changeSupport.firePropertyChange("datum", oldDatum, datum);
    }

    public String getKorisnik() {
        return korisnik;
    }

    public void setKorisnik(String korisnik) {
        String oldKorisnik = this.korisnik;
        this.korisnik = korisnik;
        changeSupport.firePropertyChange("korisnik", oldKorisnik, korisnik);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Predmeti2)) {
            return false;
        }
        Predmeti2 other = (Predmeti2) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tok.predmeta.Predmeti2[id=" + id + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
